package com.jake.zyt.service;

import com.github.pagehelper.PageHelper;
import com.jake.zyt.constant.ParamConsts;
import com.jake.zyt.entity.Order;
import com.jake.zyt.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderService {

    @Autowired
    private OrderMapper orderMapper;

    public List<Order> listOrdersByCost(Integer cost) {
        PageHelper.startPage(1, ParamConsts.PAGE_SIZE);
        return orderMapper.listOrdersByCost(cost);
    }

    public List<Order> listOrdersByHavingCustomer(String customer) {
        PageHelper.startPage(1, ParamConsts.PAGE_SIZE);
        return orderMapper.listOrdersByHavingCustomer(customer);
    }

    public List<Order> listOrdersByHavingCost(Integer cost) {
        PageHelper.startPage(1, ParamConsts.PAGE_SIZE);
        return orderMapper.listOrdersByHavingCost(cost);
    }
}
